package com.atguigu04_example.ex5;

public class StudenhtTest {
    public static void main(String[] args) {
        int n;
        double s1,s2;
        Student[] students=new Student[20];
        for (int i = 0; i < 20; i++) {
            students[i]=new Student();
        }
        for (int i = 0; i < 20; i++) {
            s1=Math.random();
            students[i].score=Math.round(s1)%101;
            s2=Math.random();
            students[i].state=Math.round(s1)%3+1;
            students[i].number=i+1;
        }

        for (int i = 0; i <students.length ; i++) {
            System.out.println(students[i].state+" "+students[i].score+" "+students[i].number);
        }
        System.out.println("----------------------");

        for (int i = 0; i <students.length ; i++) {
            if (students[i].state == 2) {
                System.out.println(students[i].state+" "+students[i].score+" "+students[i].number);
            }
        }
    }


}
